package com.ruoyi.system.service.impl;
import com.ruoyi.system.entity.PreventionHiddenInfoRecord;
import com.ruoyi.system.mapper.PreventionHiddenInfoRecordMapper;
import com.ruoyi.system.service.PreventionHiddenInfoRecordService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;

/**
 * 巡检_排查_隐患表(PreventionHiddenInfoRecord)表服务实现类
 * @since 2023-03-22 10:06:43
 */
@Service("preventionHiddenInfoRecordService")
public class PreventionHiddenInfoRecordServiceImpl implements PreventionHiddenInfoRecordService {
    @Resource
    private PreventionHiddenInfoRecordMapper preventionHiddenInfoRecordDao;

    /**
     * 通过ID查询单条数据
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public PreventionHiddenInfoRecord queryById(Integer id) {
        return this.preventionHiddenInfoRecordDao.queryById(id);
    }

    /**
     * 分页查询
     * @param preventionHiddenInfoRecord 筛选条件
     * @return 查询结果
     */
    @Override
    public List<PreventionHiddenInfoRecord> queryByPage(PreventionHiddenInfoRecord preventionHiddenInfoRecord) {
        return this.preventionHiddenInfoRecordDao.queryAllByLimit(preventionHiddenInfoRecord);
    }

    /**
     * 新增数据
     * @param preventionHiddenInfoRecord 实例对象
     * @return 实例对象
     */
    @Override
    public PreventionHiddenInfoRecord insert(PreventionHiddenInfoRecord preventionHiddenInfoRecord) {
        this.preventionHiddenInfoRecordDao.insert(preventionHiddenInfoRecord);
        return preventionHiddenInfoRecord;
    }

    /**
     * 修改数据
     * @param preventionHiddenInfoRecord 实例对象
     * @return 实例对象
     */
    @Override
    public PreventionHiddenInfoRecord update(PreventionHiddenInfoRecord preventionHiddenInfoRecord) {
        this.preventionHiddenInfoRecordDao.update(preventionHiddenInfoRecord);
        return this.queryById(preventionHiddenInfoRecord.getId());
    }

    /**
     * 通过主键删除数据
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.preventionHiddenInfoRecordDao.deleteById(id) > 0;
    }

    /**
     * @param taskId
     * @return
     */
    @Override
    public String countHidden(Integer taskId) {
        return this.preventionHiddenInfoRecordDao.countHidden(taskId);
    }
}
